-
Notifications
You must be signed in to change notification settings - Fork 4
Remove record by type #133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -1,23 +1,27 @@ | |||
CREATE TABLE record ( | |||
key TEXT NOT NULL, | |||
type TEXT NOT NULL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How wasteful is it to call this typename
? Because this is a typename
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the time but actually I've added a fallback to the schema type for the case where __typename
is not selected. But yeah typename
may be a better name and I see no waste in that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{
node {
id
... on Product {
price
}
}
}
This record will be stored with a typename
of Node
? That sounds dangerous. Might be worth throwing if typename is not queried?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This record will be stored with a typename of Node? That sounds dangerous.
✅
Might be worth throwing if typename is not queried?
Interesting! I'm hesitant because this is only useful if you need to remove by type (a rare use case). Meanwhile requiring __typename
on all selections is kind of a big change. On the other hand, __typename
will already be present in most cases when using @typePolicy
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make typename
nullable in the SQL schema and throw (or ignore) in the removeByTypes()
if the typename isn't known?
We should document what the use case is for removeByTypes()
. My hunch is that if people want to remove a certain type of data for security or expiration reasons, they probably want typename all the time (and there is an option for that in the codegen)
Closing for now as we don't have a clear for use-case for it. This can be re-opened later if needed. |
Implements #113